USE [dbdata]
GO

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[fk_identificator_set_categ_id]') AND parent_object_id = OBJECT_ID(N'[dbo].[identificator_sets]'))
ALTER TABLE [dbo].[identificator_sets] DROP CONSTRAINT [fk_identificator_set_categ_id]
GO

USE [dbdata]
GO

/****** Object:  Table [dbo].[identificator_sets]    Script Date: 03/18/2012 21:04:37 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[identificator_sets]') AND type in (N'U'))
DROP TABLE [dbo].[identificator_sets]
GO

USE [dbdata]
GO

/****** Object:  Table [dbo].[identificator_sets]    Script Date: 03/18/2012 21:04:37 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[identificator_sets](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[categ_id] [int] NOT NULL,
	[direction] [bit] NULL,
	[nominal] [money] NULL,
	[Code_a] [varchar](200) NULL,
	[period] [char](1) NULL,
	[dt_beg] [smalldatetime] NOT NULL,
	[dt_end] [smalldatetime] NULL,
 CONSTRAINT [PK__identificator_se__36B12243] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'serial barcode' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'identificator_sets', @level2type=N'COLUMN',@level2name=N'Code_a'
GO

ALTER TABLE [dbo].[identificator_sets]  WITH CHECK ADD  CONSTRAINT [fk_identificator_set_categ_id] FOREIGN KEY([categ_id])
REFERENCES [dbo].[identificator_categs] ([id])
GO

ALTER TABLE [dbo].[identificator_sets] CHECK CONSTRAINT [fk_identificator_set_categ_id]
GO

